// preload.js
// This file is currently empty.

const { contextBridge, ipcRenderer } = require("electron");

contextBridge.exposeInMainWorld("electronAPI", {
    receiveAppsData: (callback) =>
        ipcRenderer.on("app-data", (event, data) => callback(data)),
    createNewBrowserView: (url) =>
        ipcRenderer.send("create-new-browser-view", url),
    sendToMain: (channel, data) => {
        const validChannels = ['parsed-apps-data'];
        if (validChannels.includes(channel)) {
            ipcRenderer.send(channel, data);
        }
    },
    onFromMain: (channel, func) => {
        const validChannels = ['app-data'];
        if (validChannels.includes(channel)) {
            ipcRenderer.on(channel, (event, ...args) => func(...args));
        }
    }
});

window.addEventListener('DOMContentLoaded', () => {
    console.log('DOM fully loaded');
});


